﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.IO;
using System.Xml.Linq;

namespace Jukebox
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // prepare the web page we will be asking for
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://ws.audioscrobbler.com/2.0/?method=album.search&album=believe&api_key=710c97512d10ba9c106b909baf975345");

            // execute the request
            HttpWebResponse response = (HttpWebResponse) request.GetResponse();

            Stream responseStream = response.GetResponseStream();

            XDocument doc = XDocument.Load(responseStream);
            responseStream.Close();
            responseStream.Dispose();

            //uiDiv.Controls.Add(new LiteralControl(doc.ToString()));

            IJukebox j = JukeboxInstance.Instance;

            SongData d = new SongData();
            d.Album = "";

            j.AddSong(d);
        }
    }
}